load("//bazel:build.bzl", "redpanda_cc_library")
load("//src/v/schema/protobuf:well_known.bzl", "well_known_cc_protos")

redpanda_cc_library(
    name = "exceptions",
    hdrs = [
        "exceptions.h",
    ],
    visibility = ["//visibility:public"],
)

redpanda_cc_library(
    name = "types",
    srcs = [
        "error.cc",
        "types.cc",
    ],
    hdrs = [
        "error.h",
        "errors.h",
        "exceptions.h",
        "fwd.h",
        "schema_getter.h",
        "types.h",
        "util.h",
    ],
    implementation_deps = [
        "//src/v/bytes:iobuf_parser",
        "//src/v/container:chunked_vector",
        "//src/v/model",
        "//src/v/pandaproxy:error",
        "//src/v/strings:string_switch",
        "@fmt",
        "@rapidjson",
        "@seastar",
    ],
    visibility = ["//visibility:public"],
    deps = [
        "//src/v/base",
        "//src/v/json",
        "//src/v/kafka/protocol",
        "//src/v/utils:named_type",
        "@avro",
        "@boost//:outcome",
    ],
)

redpanda_cc_library(
    name = "core",
    srcs = [
        "avro.cc",
        "compatibility.cc",
        "configuration.cc",
        "json.cc",
        "protobuf.cc",
        "seq_writer.cc",
        "sharded_store.cc",
    ],
    hdrs = [
        "api.h",
        "avro.h",
        "compatibility.h",
        "configuration.h",
        "error.h",
        "errors.h",
        "exceptions.h",
        "fwd.h",
        "json.h",
        "protobuf.h",
        "schema_getter.h",
        "schema_id_cache.h",
        "seq_writer.h",
        "sharded_store.h",
        "storage.h",
        "store.h",
        "types.h",
        "util.h",
    ],
    implementation_deps = [
        "//src/v/bytes:iobuf_parser",
        "//src/v/bytes:streambuf",
        "//src/v/container:chunked_vector",
        "//src/v/container:json",
        "//src/v/hashing:jump_consistent",
        "//src/v/hashing:xx",
        "//src/v/json",
        "//src/v/kafka/protocol",
        "//src/v/metrics",
        "//src/v/model",
        "//src/v/model:batch_compression",
        "//src/v/pandaproxy:core",
        "//src/v/pandaproxy:logger",
        "//src/v/random:time_jitter",
        "//src/v/schema/protobuf:confluent_type_cc_proto",
        "//src/v/schema/protobuf:google_type_cc_proto",
        "//src/v/ssx:future_util",
        "//src/v/ssx:semaphore",
        "//src/v/ssx:sformat",
        "//src/v/storage:record_batch_builder",
        "//src/v/strings:string_switch",
        "//src/v/utils:base64",
        "//src/v/utils:named_type",
        "//src/v/utils:retry",
        "@abseil-cpp//absl/algorithm:container",
        "@abseil-cpp//absl/container:btree",
        "@abseil-cpp//absl/container:flat_hash_map",
        "@abseil-cpp//absl/container:flat_hash_set",
        "@abseil-cpp//absl/container:inlined_vector",
        "@abseil-cpp//absl/container:node_hash_map",
        "@abseil-cpp//absl/strings",
        "@avro",
        "@boost//:algorithm",
        "@boost//:graph",
        "@boost//:math",
        "@boost//:multi_index",
        "@boost//:outcome",
        "@boost//:range",
        "@fmt",
        "@jsoncons",
        "@protobuf",
        "@protobuf//src/google/protobuf/compiler:importer",
        "@protobuf//src/google/protobuf/io",
        "@protobuf//src/google/protobuf/io:tokenizer",
        "@rapidjson",
        "@re2",
    ] + well_known_cc_protos,
    visibility = ["//visibility:public"],
    deps = [
        ":config",
        ":subject_name_strategy",
        ":types",
        "//src/v/base",
        "//src/v/config",
        "//src/v/kafka/client",
        "//src/v/kafka/client:config_utils",
        "//src/v/kafka/client:configuration",
        "//src/v/kafka/client:exceptions",
        "//src/v/pandaproxy:json",
        "@seastar",
    ],
)

redpanda_cc_library(
    name = "server",
    srcs = [
        "api.cc",
        "auth.cc",
        "authorization.cc",
        "handlers.cc",
        "requests/acls.cc",
        "service.cc",
        "validation.cc",
    ],
    hdrs = [
        "api.h",
        "auth.h",
        "authorization.h",
        "configuration.h",
        "fwd.h",
        "handlers.h",
        "requests/acls.h",
        "requests/compatibility.h",
        "requests/config.h",
        "requests/get_schemas_ids_id.h",
        "requests/get_schemas_ids_id_versions.h",
        "requests/get_subject_versions_version.h",
        "requests/mode.h",
        "requests/post_subject_versions.h",
        "schema_getter.h",
        "service.h",
        "types.h",
        "validation.h",
        "validation_metrics.h",
    ],
    implementation_deps = [
        ":core",
        "//src/v/base",
        "//src/v/bytes:iobuf_parser",
        "//src/v/cluster",
        "//src/v/config",
        "//src/v/container:chunked_vector",
        "//src/v/container:json",
        "//src/v/json",
        "//src/v/kafka/client",
        "//src/v/kafka/client:config_utils",
        "//src/v/kafka/client:configuration",
        "//src/v/kafka/client:exceptions",
        "//src/v/kafka/data/rpc",
        "//src/v/kafka/protocol",
        "//src/v/kafka/protocol:create_topics",
        "//src/v/kafka/protocol:list_offset",
        "//src/v/kafka/server:topic_config_utils",
        "//src/v/metrics",
        "//src/v/model",
        "//src/v/model:batch_compression",
        "//src/v/pandaproxy:core",
        "//src/v/pandaproxy:json",
        "//src/v/pandaproxy:logger",
        "//src/v/pandaproxy:parsing",
        "//src/v/pandaproxy:schema_registry_swagger_definitions",
        "//src/v/security",
        "//src/v/security:request_auth",
        "//src/v/security/audit",
        "//src/v/security/audit:types",
        "//src/v/ssx:semaphore",
        "//src/v/strings:string_switch",
        "//src/v/strings:utf8",
        "//src/v/utils:adjustable_semaphore",
        "//src/v/utils:named_type",
        "//src/v/utils:tristate",
        "@abseil-cpp//absl/algorithm:container",
        "@abseil-cpp//absl/strings",
        "@avro",
        "@boost//:algorithm",
        "@seastar",
    ],
    visibility = ["//visibility:public"],
    deps = [
        ":config",
        ":subject_name_strategy",
        ":types",
        "//src/v/kafka/client",
    ],
)

redpanda_cc_library(
    name = "registry",
    srcs = [],
    hdrs = [
        "api.h",
        "avro.h",
        "compatibility.h",
        "configuration.h",
        "fwd.h",
        "json.h",
        "protobuf.h",
        "schema_getter.h",
        "seq_writer.h",
        "service.h",
        "sharded_store.h",
        "types.h",
        "validation.h",
    ],
    implementation_deps = [
        "//src/v/cluster",
    ],
    visibility = ["//visibility:public"],
    deps = [
        ":server",
        "//src/v/pandaproxy:core",
    ],
)

redpanda_cc_library(
    name = "config",
    hdrs = [
        "schema_id_validation.h",
    ],
    visibility = ["//visibility:public"],
    deps = [
        "//src/v/strings:string_switch",
        "@seastar",
    ],
)

redpanda_cc_library(
    name = "subject_name_strategy",
    hdrs = [
        "subject_name_strategy.h",
    ],
    visibility = ["//visibility:public"],
    deps = [
        "//src/v/base",
        "//src/v/strings:string_switch",
    ],
)
